package Atm01;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel  extends  JPanel  implements ActionListener{
    private ATMFrame atmFrame;

    private JLabel getmoneyLabel = new JLabel();

    private JButton backBtn= new JButton (new ImageIcon("Images/buttonSure.jpg"));


    private Font font = new Font("黑体",Font.BOLD,30);

    public SearchPanel(ATMFrame atmFrame){
        this.atmFrame=atmFrame;
        this.setLayout(null);
       backBtn.setBounds(580,300,150,50);
        backBtn.addActionListener(this);


        getmoneyLabel.setBounds(350,200,400,50);
        getmoneyLabel.setFont(font);
        this.add(getmoneyLabel);
        this.add(backBtn);
        this.setOpaque(false);

    }

    public void showBlance()
    {
       getmoneyLabel.setText("你的余额为：" + atmFrame.getLoginUser().getBlance());
    }

    
    public void showBlance1()
    {
        getmoneyLabel.setText("你的余额为：" + atmFrame.getUsers());
    }



    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == backBtn) {
            atmFrame.switchPanel("menu");
        }

    }
}
